﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace GTasksPlus.Helpers
{
    public class DateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var formatString = value as string;
            if (!string.IsNullOrEmpty(formatString))
            {
                return DateTime.Parse(formatString).Date;
            }
            return String.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return String.Empty;
        }
    }
}
